home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / gcc / geninline_920614.lha / inline-2.0 / utility.h < prev    next >
C/C++ Source or Header  |  1992-06-14  |  11KB  |  370 lines

  1. #ifndef _INLINE_UTILITY_H
  2. #define _INLINE_UTILITY_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <inline/stubs.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. #ifndef BASE_EXT_DECL
  10. #define BASE_EXT_DECL extern struct UtilityBase*  UtilityBase;
  11. #endif
  12. #ifndef BASE_PAR_DECL
  13. #define BASE_PAR_DECL
  14. #define BASE_PAR_DECL0 void
  15. #endif
  16. #ifndef BASE_NAME
  17. #define BASE_NAME UtilityBase
  18. #endif
  19.  
  20. static __inline struct TagItem *
  21. AllocateTagItems (BASE_PAR_DECL unsigned long numItems)
  22. {
  23.   BASE_EXT_DECL
  24.   register struct TagItem * _res  __asm("d0");
  25.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  26.   register unsigned long d0 __asm("d0") = numItems;
  27.   __asm __volatile ("jsr a6@(-0x42)"
  28.   : "=r" (_res)
  29.   : "r" (a6), "r" (d0)
  30.   : "a0","a1","d0","d1");
  31.   return _res;
  32. }
  33. static __inline void 
  34. Amiga2Date (BASE_PAR_DECL unsigned long amigaTime,struct ClockData *date)
  35. {
  36.   BASE_EXT_DECL
  37.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  38.   register unsigned long d0 __asm("d0") = amigaTime;
  39.   register struct ClockData *a0 __asm("a0") = date;
  40.   __asm __volatile ("jsr a6@(-0x78)"
  41.   : /* no output */
  42.   : "r" (a6), "r" (d0), "r" (a0)
  43.   : "a0","a1","d0","d1");
  44.   *(char *)a0 = *(char *)a0;
  45. }
  46. static __inline ULONG 
  47. CallHookPkt (BASE_PAR_DECL struct Hook *hook,APTR object,APTR paramPacket)
  48. {
  49.   BASE_EXT_DECL
  50.   register ULONG  _res  __asm("d0");
  51.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  52.   register struct Hook *a0 __asm("a0") = hook;
  53.   register APTR a2 __asm("a2") = object;
  54.   register APTR a1 __asm("a1") = paramPacket;
  55.   __asm __volatile ("jsr a6@(-0x66)"
  56.   : "=r" (_res)
  57.   : "r" (a6), "r" (a0), "r" (a2), "r" (a1)
  58.   : "a0","a1","a2","d0","d1");
  59.   *(char *)a0 = *(char *)a0;  *(char *)a2 = *(char *)a2;  *(char *)a1 = *(char *)a1;
  60.   return _res;
  61. }
  62. static __inline ULONG 
  63. CheckDate (BASE_PAR_DECL struct ClockData *date)
  64. {
  65.   BASE_EXT_DECL
  66.   register ULONG  _res  __asm("d0");
  67.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  68.   register struct ClockData *a0 __asm("a0") = date;
  69.   __asm __volatile ("jsr a6@(-0x84)"
  70.   : "=r" (_res)
  71.   : "r" (a6), "r" (a0)
  72.   : "a0","a1","d0","d1");
  73.   *(char *)a0 = *(char *)a0;
  74.   return _res;
  75. }
  76. static __inline struct TagItem *
  77. CloneTagItems (BASE_PAR_DECL struct TagItem *tagList)
  78. {
  79.   BASE_EXT_DECL
  80.   register struct TagItem * _res  __asm("d0");
  81.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  82.   register struct TagItem *a0 __asm("a0") = tagList;
  83.   __asm __volatile ("jsr a6@(-0x48)"
  84.   : "=r" (_res)
  85.   : "r" (a6), "r" (a0)
  86.   : "a0","a1","d0","d1");
  87.   *(char *)a0 = *(char *)a0;
  88.   return _res;
  89. }
  90. static __inline ULONG 
  91. Date2Amiga (BASE_PAR_DECL struct ClockData *date)
  92. {
  93.   BASE_EXT_DECL
  94.   register ULONG  _res  __asm("d0");
  95.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  96.   register struct ClockData *a0 __asm("a0") = date;
  97.   __asm __volatile ("jsr a6@(-0x7e)"
  98.   : "=r" (_res)
  99.   : "r" (a6), "r" (a0)
  100.   : "a0","a1","d0","d1");
  101.   *(char *)a0 = *(char *)a0;
  102.   return _res;
  103. }
  104. static __inline void 
  105. FilterTagChanges (BASE_PAR_DECL struct TagItem *newTagList,struct TagItem *oldTagList,long apply)
  106. {
  107.   BASE_EXT_DECL
  108.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  109.   register struct TagItem *a0 __asm("a0") = newTagList;
  110.   register struct TagItem *a1 __asm("a1") = oldTagList;
  111.   register long d0 __asm("d0") = apply;
  112.   __asm __volatile ("jsr a6@(-0x36)"
  113.   : /* no output */
  114.   : "r" (a6), "r" (a0), "r" (a1), "r" (d0)
  115.   : "a0","a1","d0","d1");
  116.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  117. }
  118. static __inline LONG 
  119. FilterTagItems (BASE_PAR_DECL struct TagItem *tagList,Tag *filterArray,long logic)
  120. {
  121.   BASE_EXT_DECL
  122.   register LONG  _res  __asm("d0");
  123.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  124.   register struct TagItem *a0 __asm("a0") = tagList;
  125.   register Tag *a1 __asm("a1") = filterArray;
  126.   register long d0 __asm("d0") = logic;
  127.   __asm __volatile ("jsr a6@(-0x60)"
  128.   : "=r" (_res)
  129.   : "r" (a6), "r" (a0), "r" (a1), "r" (d0)
  130.   : "a0","a1","d0","d1");
  131.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  132.   return _res;
  133. }
  134. static __inline struct TagItem *
  135. FindTagItem (BASE_PAR_DECL Tag tagVal,struct TagItem *tagList)
  136. {
  137.   BASE_EXT_DECL
  138.   register struct TagItem * _res  __asm("d0");
  139.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  140.   register Tag d0 __asm("d0") = tagVal;
  141.   register struct TagItem *a0 __asm("a0") = tagList;
  142.   __asm __volatile ("jsr a6@(-0x1e)"
  143.   : "=r" (_res)
  144.   : "r" (a6), "r" (d0), "r" (a0)
  145.   : "a0","a1","d0","d1");
  146.   *(char *)a0 = *(char *)a0;
  147.   return _res;
  148. }
  149. static __inline void 
  150. FreeTagItems (BASE_PAR_DECL struct TagItem *tagList)
  151. {
  152.   BASE_EXT_DECL
  153.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  154.   register struct TagItem *a0 __asm("a0") = tagList;
  155.   __asm __volatile ("jsr a6@(-0x4e)"
  156.   : /* no output */
  157.   : "r" (a6), "r" (a0)
  158.   : "a0","a1","d0","d1");
  159.   *(char *)a0 = *(char *)a0;
  160. }
  161. static __inline ULONG 
  162. GetTagData (BASE_PAR_DECL Tag tagVal,unsigned long defaultVal,struct TagItem *tagList)
  163. {
  164.   BASE_EXT_DECL
  165.   register ULONG  _res  __asm("d0");
  166.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  167.   register Tag d0 __asm("d0") = tagVal;
  168.   register unsigned long d1 __asm("d1") = defaultVal;
  169.   register struct TagItem *a0 __asm("a0") = tagList;
  170.   __asm __volatile ("jsr a6@(-0x24)"
  171.   : "=r" (_res)
  172.   : "r" (a6), "r" (d0), "r" (d1), "r" (a0)
  173.   : "a0","a1","d0","d1");
  174.   *(char *)a0 = *(char *)a0;
  175.   return _res;
  176. }
  177. static __inline void 
  178. MapTags (BASE_PAR_DECL struct TagItem *tagList,struct TagItem *mapList,long includeMiss)
  179. {
  180.   BASE_EXT_DECL
  181.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  182.   register struct TagItem *a0 __asm("a0") = tagList;
  183.   register struct TagItem *a1 __asm("a1") = mapList;
  184.   register long d0 __asm("d0") = includeMiss;
  185.   __asm __volatile ("jsr a6@(-0x3c)"
  186.   : /* no output */
  187.   : "r" (a6), "r" (a0), "r" (a1), "r" (d0)
  188.   : "a0","a1","d0","d1");
  189.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  190. }
  191. static __inline struct TagItem *
  192. NextTagItem (BASE_PAR_DECL struct TagItem **tagListPtr)
  193. {
  194.   BASE_EXT_DECL
  195.   register struct TagItem * _res  __asm("d0");
  196.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  197.   register struct TagItem **a0 __asm("a0") = tagListPtr;
  198.   __asm __volatile ("jsr a6@(-0x30)"
  199.   : "=r" (_res)
  200.   : "r" (a6), "r" (a0)
  201.   : "a0","a1","d0","d1");
  202.   *(char *)a0 = *(char *)a0;
  203.   return _res;
  204. }
  205. static __inline ULONG 
  206. PackBoolTags (BASE_PAR_DECL unsigned long initialFlags,struct TagItem *tagList,struct TagItem *boolMap)
  207. {
  208.   BASE_EXT_DECL
  209.   register ULONG  _res  __asm("d0");
  210.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  211.   register unsigned long d0 __asm("d0") = initialFlags;
  212.   register struct TagItem *a0 __asm("a0") = tagList;
  213.   register struct TagItem *a1 __asm("a1") = boolMap;
  214.   __asm __volatile ("jsr a6@(-0x2a)"
  215.   : "=r" (_res)
  216.   : "r" (a6), "r" (d0), "r" (a0), "r" (a1)
  217.   : "a0","a1","d0","d1");
  218.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  219.   return _res;
  220. }
  221. static __inline void 
  222. RefreshTagItemClones (BASE_PAR_DECL struct TagItem *cloneList,struct TagItem *origList)
  223. {
  224.   BASE_EXT_DECL
  225.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  226.   register struct TagItem *a0 __asm("a0") = cloneList;
  227.   register struct TagItem *a1 __asm("a1") = origList;
  228.   __asm __volatile ("jsr a6@(-0x54)"
  229.   : /* no output */
  230.   : "r" (a6), "r" (a0), "r" (a1)
  231.   : "a0","a1","d0","d1");
  232.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  233. }
  234. static __inline LONG 
  235. SDivMod32 (BASE_PAR_DECL long dividend,long divisor)
  236. {
  237.   BASE_EXT_DECL
  238.   register LONG  _res  __asm("d0");
  239.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  240.   register long d0 __asm("d0") = dividend;
  241.   register long d1 __asm("d1") = divisor;
  242.   __asm __volatile ("jsr a6@(-0x96)"
  243.   : "=r" (_res)
  244.   : "r" (a6), "r" (d0), "r" (d1)
  245.   : "a0","a1","d0","d1");
  246.   return _res;
  247. }
  248. static __inline LONG 
  249. SMult32 (BASE_PAR_DECL long factor1,long factor2)
  250. {
  251.   BASE_EXT_DECL
  252.   register LONG  _res  __asm("d0");
  253.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  254.   register long d0 __asm("d0") = factor1;
  255.   register long d1 __asm("d1") = factor2;
  256.   __asm __volatile ("jsr a6@(-0x8a)"
  257.   : "=r" (_res)
  258.   : "r" (a6), "r" (d0), "r" (d1)
  259.   : "a0","a1","d0","d1");
  260.   return _res;
  261. }
  262. static __inline LONG 
  263. Stricmp (BASE_PAR_DECL UBYTE *string1,UBYTE *string2)
  264. {
  265.   BASE_EXT_DECL
  266.   register LONG  _res  __asm("d0");
  267.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  268.   register UBYTE *a0 __asm("a0") = string1;
  269.   register UBYTE *a1 __asm("a1") = string2;
  270.   __asm __volatile ("jsr a6@(-0xa2)"
  271.   : "=r" (_res)
  272.   : "r" (a6), "r" (a0), "r" (a1)
  273.   : "a0","a1","d0","d1");
  274.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  275.   return _res;
  276. }
  277. static __inline LONG 
  278. Strnicmp (BASE_PAR_DECL UBYTE *string1,UBYTE *string2,long length)
  279. {
  280.   BASE_EXT_DECL
  281.   register LONG  _res  __asm("d0");
  282.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  283.   register UBYTE *a0 __asm("a0") = string1;
  284.   register UBYTE *a1 __asm("a1") = string2;
  285.   register long d0 __asm("d0") = length;
  286.   __asm __volatile ("jsr a6@(-0xa8)"
  287.   : "=r" (_res)
  288.   : "r" (a6), "r" (a0), "r" (a1), "r" (d0)
  289.   : "a0","a1","d0","d1");
  290.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  291.   return _res;
  292. }
  293. static __inline BOOL 
  294. TagInArray (BASE_PAR_DECL Tag tagVal,Tag *tagArray)
  295. {
  296.   BASE_EXT_DECL
  297.   register BOOL  _res  __asm("d0");
  298.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  299.   register Tag d0 __asm("d0") = tagVal;
  300.   register Tag *a0 __asm("a0") = tagArray;
  301.   __asm __volatile ("jsr a6@(-0x5a)"
  302.   : "=r" (_res)
  303.   : "r" (a6), "r" (d0), "r" (a0)
  304.   : "a0","a1","d0","d1");
  305.   *(char *)a0 = *(char *)a0;
  306.   return _res;
  307. }
  308. static __inline UBYTE 
  309. ToLower (BASE_PAR_DECL unsigned long character)
  310. {
  311.   BASE_EXT_DECL
  312.   register UBYTE  _res  __asm("d0");
  313.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  314.   register unsigned long d0 __asm("d0") = character;
  315.   __asm __volatile ("jsr a6@(-0xba)"
  316.   : "=r" (_res)
  317.   : "r" (a6), "r" (d0)
  318.   : "a0","a1","d0","d1");
  319.   return _res;
  320. }
  321. static __inline UBYTE 
  322. ToUpper (BASE_PAR_DECL unsigned long character)
  323. {
  324.   BASE_EXT_DECL
  325.   register UBYTE  _res  __asm("d0");
  326.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  327.   register unsigned long d0 __asm("d0") = character;
  328.   __asm __volatile ("jsr a6@(-0xae)"
  329.   : "=r" (_res)
  330.   : "r" (a6), "r" (d0)
  331.   : "a0","a1","d0","d1");
  332.   return _res;
  333. }
  334. static __inline ULONG 
  335. UDivMod32 (BASE_PAR_DECL unsigned long dividend,unsigned long divisor)
  336. {
  337.   BASE_EXT_DECL
  338.   register ULONG  _res  __asm("d0");
  339.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  340.   register unsigned long d0 __asm("d0") = dividend;
  341.   register unsigned long d1 __asm("d1") = divisor;
  342.   __asm __volatile ("jsr a6@(-0x9c)"
  343.   : "=r" (_res)
  344.   : "r" (a6), "r" (d0), "r" (d1)
  345.   : "a0","a1","d0","d1");
  346.   return _res;
  347. }
  348. static __inline ULONG 
  349. UMult32 (BASE_PAR_DECL unsigned long factor1,unsigned long factor2)
  350. {
  351.   BASE_EXT_DECL
  352.   register ULONG  _res  __asm("d0");
  353.   register struct UtilityBase* a6 __asm("a6") = BASE_NAME;
  354.   register unsigned long d0 __asm("d0") = factor1;
  355.   register unsigned long d1 __asm("d1") = factor2;
  356.   __asm __volatile ("jsr a6@(-0x90)"
  357.   : "=r" (_res)
  358.   : "r" (a6), "r" (d0), "r" (d1)
  359.   : "a0","a1","d0","d1");
  360.   return _res;
  361. }
  362. #undef BASE_EXT_DECL
  363. #undef BASE_PAR_DECL
  364. #undef BASE_PAR_DECL0
  365. #undef BASE_NAME
  366.  
  367. __END_DECLS
  368.  
  369. #endif /* _INLINE_UTILITY_H */
  370.